package com.nari.ies.ne.nw.server.util;

import com.nari.ies.ne.nw.server.entity.FileDataCheckEntity;
import com.nari.ies.ne.nw.server.mapper.FileScoreMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;
import java.util.Map;

public class DataUtil {

    @Autowired
    private static FileScoreMapper fileScoreMapper;

    public static Date queryTime(String len) {
        String[] strings = len.split("'");

        String time1 = strings[1];
        String time2 = strings[3];

        String time = time1 + " " + time2.replaceAll("-", ":");
        Date forecast = null;
        try {
            forecast = DateUtil.SDF_SS.parse(time);
        } catch (java.text.ParseException e) {
            e.printStackTrace();
        }

        return forecast;

    }

    public static FileDataCheckEntity getFileDataCheckEntity(String plantId,Date forecastDate,Date createDate,String plantType,String fileType,String dataType,int noData,int qualifiedData,int unqualifiedData){

        FileDataCheckEntity fileDataCheckEntity = new FileDataCheckEntity();

        fileDataCheckEntity.setPlantId(plantId);
        fileDataCheckEntity.setForecastDate(forecastDate);
        fileDataCheckEntity.setCreateDate(createDate);
        fileDataCheckEntity.setPlantType(plantType);
        fileDataCheckEntity.setFileType(fileType);
        fileDataCheckEntity.setDataType(dataType);
        fileDataCheckEntity.setNoData(noData);
        fileDataCheckEntity.setQualifiedData(qualifiedData);
        fileDataCheckEntity.setUnqualifiedData(unqualifiedData);
        return fileDataCheckEntity;
    }


}
